<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/MesquiteTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


<!-- InstanceBeginEditable name="doctitle" -->
<title>Simulating Characters</title>
<!-- InstanceEndEditable -->

<![endif]--><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.thrColFixHdr #sidebar2, .thrColFixHdr #sidebar1 { padding-top: 30px; }
.thrColFixHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->

<style type="text/css">
<!--
-->
</style>
<link href="CSS/mesquitePackage.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />

<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script type="text/javascript" src="SpryAssets/SpryURLUtils.js"></script>
<script type="text/javascript" src="javascript/mesquite.js"></script>

<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body bgcolor="#ffffff" class="thrColFixHdr" >

<div id="container">
  <div id="header">
    <table width="100%" border="0" cellpadding="4">
  <tr>
    <td width="51%"><strong id="PackageTitle">Mesquite</strong></td>
    <td width="33%" align="right"><div id="subtitle"><!-- InstanceBeginEditable name="subtitle" -->Simulating Characters<!-- InstanceEndEditable --></div></td>
    <td width="2%">&nbsp;</td>
    <td width="14%">Version 3.81<br />
      April 2023<br /></td>
  </tr>
</table>

</div>
  
  
<div id="sidebar1">
  
  
  
  
  <div id="NonCollapsiblePanel">
    <a href="javascript:pageLink('http://www.mesquiteproject.org')">Mesquite Website Home</a>
  </div>
  <div id="NonCollapsiblePanel">
    <a href="javascript:pageLink('home.html')">Introduction</a>
  </div>
  <div id="NonCollapsiblePanel">
    <a href="javascript:pageLink('Installation.html')">Download & Installation</a>
  </div>
  <div id="NonCollapsiblePanel">
    <a href="javascript:pageLink('History%20of%20New%20Features.html')">Recent Changes</a>
  </div>

  <div id="OverviewOfMesquitePanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Overview of Mesquite ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('What%20Mesquite%20does.html');">What Mesquite Does</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Mesquites%20Features.html');">List of Features</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Development%20Team.html');">Development Team</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Contact%20Us.html');">Contact Us</a></td></tr>
		</table>
    </div>
  </div>
  <div id="GettingStartedPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Getting Started ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('Installation.html');">Download and Installation</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Additional%20Mesquite%20Packages.html');">Additional Packages</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Beginning%20Mesquite.html');">Beginning Mesquite</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Example%20Files.html');">Example Files</a></td></tr>
		</table>
    </div>
  </div>
  <div id="BasicMesquiteOperationPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Basic  Operations ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('Files.html');">Files</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Menus.html');">Menus</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Windows.html');">Windows</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Charts.html');">Charts</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Selection.html');">Selection</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Modules.html');">Modules</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Simplifying%20the%20Interface.html');">Simplifying Mesquite</a></td></tr>
		</table>
    </div>
  </div>
  <div id="TaxaTreesCharactersPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Taxa, Trees, Characters ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('Characters%20&%20Matrices.html');">Characters &amp; Matrices</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Taxa.html');">Taxa</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Trees.html');">Trees</a></td></tr>
		</table>
    </div>
  </div>
  <div id="AnalysesPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Analyses ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('Character%20Evolution.html');">Character Evolution</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Align.html');">Sequence Alignment</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Analyzing%20Molecular%20Data.html');">Molecular Data</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Diversification.html');">Diversification</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Gene%20Trees.html');">Gene Trees</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Simulations%20&%20Randomizations.html');">Simulations &amp; Randomizations</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Analyzing%20Continuous%20Characters.html');">Continuous Characters</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Studies%20of%20Tree%20Topology.html');">Studies of Tree Topology</a></td></tr>
		</table>
    </div>
  </div>
  <div id="WorkflowsPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Workflows ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('Managing%20Molecular%20Data.html');">Managing Molecular Data</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Managing%20Continuous%20Data.html');">Managing Continuous Data</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Interactions%20with%20Other%20Programs.html');">Interactions with other programs</a></td></tr>
		</table>
    </div>
  </div>
  <div id="GettingHelpPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Getting Help ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('Learning%20how%20to%20use%20Mesquite.html');">Learning Mesquite</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Simplifying%20the%20Interface.html');">Simplifying Mesquite</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Bugs%20and%20Troubleshooting.html');">Bugs &amp; Troubleshooting</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Getting%20Help.html');">Getting Help</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Suggesting%20New%20Features.html');">Your Suggestions</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Glossary.html');">Glossary</a></td></tr>
  			<tr><td><a href="javascript:pageLink('FAQ.html');">FAQ</a></td></tr>
		</table>
    </div>
  </div>
  <div id="TechnicalDetailsPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Technical Details ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('How%20Mesquite%20Works.html');">How Mesquite Works</a></td></tr>
  			<tr><td><a href="javascript:pageLink('MesquiteLogSupport.html');">Log & Support Files</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Scripts%20&%20Macros.html');">Scripts &amp; Macros</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Source%20Code.html');">Source Code</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Developers%20Documentation.html');">Developer's Documentation</a></td></tr>
		</table>
    </div>
  </div>
  <div id="HistoryPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">History ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('History%20of%20Mesquite.html');">History of Mesquite</a></td></tr>
  			<tr><td><a href="javascript:pageLink('whyMesquite.html');">Why Mesquite?</a></td></tr>
  			<tr><td><a href="javascript:pageLink('History%20of%20New%20Features.html');">New Features & Bug List</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Release%20Dates.html');">Release Dates</a></td></tr>
		</table>
    </div>
  </div>
  <div id="PublishingResultsPanel" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0">Publishing Results ˇ</div>
    <div class="CollapsiblePanelContent" style="display: block">
  		<table width="100%" border="0" cellpadding="1">
  			<tr><td><a href="javascript:pageLink('Documenting%20Your%20Work.html');">Documenting your work</a></td></tr>
  			<tr><td><a href="javascript:pageLink('How%20to%20Cite%20Mesquite.html');">Citing Mesquite</a></td></tr>
  			<tr><td><a href="javascript:pageLink('Publishing%20Results.html');">Publishing results</a></td></tr>
		</table>
    </div>
  </div>

  <div id="NonCollapsiblePanel">
    <a href="javascript:pageLink('Acknowledgements.html')">Acknowledgments</a>
  </div>

<h3>&nbsp;</h3>
  <!-- end #sidebar1 --></div>

  <div id="mainContent">
    
<!-- InstanceBeginEditable name="content" -->
    
    
<h1 id="toc0"><a name="Character simulations and randomizations"></a>Character simulations and randomizations</h1>
 Mesquite can simulate and randomize characters to build statistical tests. On this page we give an overview of these features. A more in-depth account of simulation of DNA sequence evolution is given <a  href="Simulating%20DNA%20Evolution.html">separately</a>.<br />
<h4 id="toc1"><a name="Character simulations and randomizations---Contents"></a>Contents</h4>
 <br />
<ul><li><a  href="Simulating%20Characters.html#using">Using results of simulations &amp; randomizations</a></li><li><a  href="Simulating%20Characters.html#simulations">Simulations of character evolution</a></li><li><a  href="Simulating%20Characters.html#viewing">Viewing results of simulations</a></li><li><a  href="Simulating%20Characters.html#randomizing">Randomizing characters</a></li></ul><br />
<br />
<h2 id="toc2"><a name="Character simulations and randomizations-Using results of simulations &amp; randomizations"></a><a name="using"></a>Using results of simulations &amp; randomizations</h2>
 The simulated or randomized characters can be used or stored in several ways:<br />
<ul><li>The characters can be stored into matrices in the current file by choosing options in theMake New Matrix from submenu of the Characters menu. For instance, if you choose Simulated Matrices on Current Tree, the matrix simulated will be stored in the file.</li><li>The characters may be used directly, at that moment, in calculations. For example, if you make a Bar &amp; Line Chart for Characters, and choose Simulated Characters as your source of characters, the characters will be simulated and used in the chart without being stored in the file.</li><li>A series of many data files can be saved, each one with a different replicate of the simulated or randomized data matrix. This is available through the Save Multiple Matrices submenu of the Character menu</li><li>A series of many data files can be saved in combination with scripting files to instruct programs such as Swofford's PAUP to run the files. This can be done using the Batch Architect, a description of which is in the page on <a  href="Simulating%20DNA%20Evolution.html">DNA simulations</a> and some of the <a  href="Studies%20of%20Tree%20Topology.html">Studies</a>.</li></ul><br />
To replicate the results of a simulation or randomization, you can use the Set Seed menu item to set the random number seed used. If you are using the same conditions, including the same seed, the simulations and randomizations should be reproducable.<br />
<h2 id="toc3"><a name="Character simulations and randomizations-Simulations of character evolution"></a><a name="simulations"></a>Simulations of character evolution</h2>
 Stochastic models can be used to simulate character evolution along the branches of a phylogenetic tree by selecting Simulated Characters (to generate characters one at a time) or Simulated Matrices on Current Tree (to generate whole matrices, on a current tree in a Tree Window), or Simulated Matrices on Trees (to generate whole matrices, each one on a different tree from a source of trees). These options are available whenever characters or matrices might be called for, for instance when making a chart of characters or matrices.<br />
The following are the character types and models that can be simulated:<br />
<ul><li>Evolve Categorical characters. The following models are also discussed in the section on <a  href="Ancestral%20States.html#likelihood">likelihood reconstructions</a>.<ul><li>Mk1 model — Single parameter model analogous to Jukes-Cantor. Rates of change equal for all types of state-to-state changes.</li><li>AsymmMk model — Two parameter asymmetrical model with differing rates of forward and backward changes. Forward changes are those in which state number increases (e.g., state 0 to state 1); backward changes are those in which state decreases (e.g., state 1 to state 0). One can specify the forward and backward rates directly, or alternatively, one can specify an overall rate of change in combination with a bias of forward versus backward. This model will generally be appropriate only for binary characters. You can also specify whether the states are the root are assumed to be at the equilibrium frequencies implied by the model. If so, then Mesquite chooses an ancestral state in the simulations according to the equilibrium frequencies implied by the bias in gains versus losses. Otherwise, Mesquite chooses a state with equal probabilities.</li></ul></li><li>Evolve DNA characters<ul><li>See page on <a  href="Simulating%20DNA%20Evolution.html">DNA simulations</a> for details.</li></ul></li><li>Evolve Continous characters<ul><li>Brownian motion model — Model with a single parameter, the rate of change.</li></ul></li></ul>To use these simulations, the appropriate character model must be defined in advance, with all of its parameters specified. Two models come built-in: a Jukes-Cantor model for DNA simulations, and a Brownian motion model for continuous variable simulations. If you want any other models, created them using New Character Model in the Characters menu.<br />
<h2 id="toc4"><a name="Character simulations and randomizations-Viewing results of simulations"></a><a name="viewing"></a>Viewing results of simulations</h2>
 Simulated characters can be used in many calculations, but if you want to visualize directly the results of a simulations you can use the Trace Character History feature available in the Analysis:Tree menu of the Tree Window. By default Trace Character History shows a reconstruction of ancestral states. Thus, if the character is simulated, the states at nodes shown would not be the &quot;true&quot; ancestral states that occurred during the simulation, but rather states inferred from the states given to the terminal taxa by the simulation. However, once Trace Character History is active, its Trace menu has a Character History Source menu item. Choose Simulate Ancestral States and specify the simulation. The states indicated at the nodes will then be the true ancestral states in the simulation. You can set the Seed to make the simulation equivalent to simulations done in other contexts.<br />
<h2 id="toc5"><a name="Character simulations and randomizations-Randomizing characters"></a><a name="randomizing"></a>Randomizing characters</h2>
 Existing characters can be randomized as follows:<br />
<ul><li>Reshuffle Character — Supplies replicate reshufflings of a single chosen character. In each reshuffling, the character states are randomly scrambled among taxa, keeping the frequencies of different character states fixed.</li><li>Reshuffle States within Characters— Supplies matrices, each of which is a reshuffling of an existing matrix. The first character of the matrix is a reshuffling of the first character of the original matrix; the second character is a reshuffling of the second original character; and so on. You can think of this as reshuffling within each column of the matrix.</li><li>Reshuffle Within Characters (Taxa Partitioned) — As for Reshuffle States within Characters, but respecting taxa partitions. Each character of the matrix is a reshuffling of the respective character of the original matrix, but done only within groups of the current taxa partition. Thus, if taxa have a current <a  href="Taxa.html#groups">partition</a> that divides the taxa into Group A and Group B, then the reshuffling within a character first shuffles all states of the character among Group A taxa. Then, it shuffles states of the character within Group B taxa.</li><li>Reshuffle States Within Taxa — Supplies matrices, each of which is a reshuffling of an existing matrix. Instead of reshuffling within each column, this reshuffles within each row. Thus, the states of each taxon are reshuffled among characters. This might be used, for instance, to generate DNA data with no phylogenetic signal that preserves the base composition of each taxon.</li><li>Reshuffle Within Taxa (Char. Partitioned) — As for Reshuffle States within Taxa, but respecting character paritions. Thus, if the characters have a current partition that divides them into (for example) groups 28S and COI, then the reshuffling within a taxon first shuffles all states of a taxon among 28S sites, then shuffles all states of the taxon among COI sites.</li><li>Bootstrap resample — Supplies matrices, each of which is a bootstrap resampled version of an existing matrix. Characters are sampled randomly from the original matrix and moved into the resampled matrix until it contains as many characters as were in the original matrix. Some of the original characters may by chance be sampled more than once; some may be not sampled at all.</li><li>Rarefy characters — Supplies matrices, each of which is derived from an existing matrix by randomly deleting entire characters.</li><li>Sprinkle missing — Supplies matrices, each of which is derived from an existing matrix by randomly assigning &quot;missing&quot; (? or unassigned) to cells of the matrix with a particular probability.</li><li>Add noise (for continuous matrices only) — Available in the Character Matrix Editor under Alter/Transform, this adds noise to the states of all or selected cells of the matrix.</li><li>Random Fill — Available in the Alter/Transform of the Matrix menu of the Character Matrix Editor, it can be used to fill all or selected cells of the matrix with randomly chosen states.</li></ul>
<!-- InstanceEndEditable -->

    
    
    </div>
	<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
  <div id="footer">
    <p> ©2023 Wayne P. Maddison &amp;  David R. Maddison </p>
  <!-- end #footer --></div>
<!-- end #container --></div>

<script type="text/javascript">
<!--


var OverviewOfMesquitePanel = null;
var GettingStartedPanel = null;
var BasicMesquiteOperationPanel = null;
var TaxaTreesCharactersPanel = null;
var AnalysesPanel = null;
var WorkflowsPanel = null;
var GettingHelpPanel = null;
var TechnicalDetailsPanel = null;
var HistoryPanel = null;
var PublishingResultsPanel = null;

if (qsParm['BasicMesquiteOperationPanel']=='open')
 	BasicMesquiteOperationPanel = new Spry.Widget.CollapsiblePanel("BasicMesquiteOperationPanel", {contentIsOpen: true});
else
 	BasicMesquiteOperationPanel = new Spry.Widget.CollapsiblePanel("BasicMesquiteOperationPanel", {contentIsOpen: false});
	
if (qsParm['OverviewOfMesquitePanel']=='open')
 	OverviewOfMesquitePanel = new Spry.Widget.CollapsiblePanel("OverviewOfMesquitePanel", {contentIsOpen: true});
else
 	OverviewOfMesquitePanel = new Spry.Widget.CollapsiblePanel("OverviewOfMesquitePanel", {contentIsOpen: false});
	
if (qsParm['GettingStartedPanel']=='open')
 	GettingStartedPanel = new Spry.Widget.CollapsiblePanel("GettingStartedPanel", {contentIsOpen: true});
else
 	GettingStartedPanel = new Spry.Widget.CollapsiblePanel("GettingStartedPanel", {contentIsOpen: false});

if (qsParm['TaxaTreesCharactersPanel']=='open')
 	TaxaTreesCharactersPanel = new Spry.Widget.CollapsiblePanel("TaxaTreesCharactersPanel", {contentIsOpen: true});
else
 	TaxaTreesCharactersPanel = new Spry.Widget.CollapsiblePanel("TaxaTreesCharactersPanel", {contentIsOpen: false});

if (qsParm['AnalysesPanel']=='open')
 	AnalysesPanel = new Spry.Widget.CollapsiblePanel("AnalysesPanel", {contentIsOpen: true});
else
 	AnalysesPanel = new Spry.Widget.CollapsiblePanel("AnalysesPanel", {contentIsOpen: false});

if (qsParm['WorkflowsPanel']=='open')
 	WorkflowsPanel = new Spry.Widget.CollapsiblePanel("WorkflowsPanel", {contentIsOpen: true});
else
 	WorkflowsPanel = new Spry.Widget.CollapsiblePanel("WorkflowsPanel", {contentIsOpen: false});

if (qsParm['GettingHelpPanel']=='open')
 	GettingHelpPanel = new Spry.Widget.CollapsiblePanel("GettingHelpPanel", {contentIsOpen: true});
else
 	GettingHelpPanel = new Spry.Widget.CollapsiblePanel("GettingHelpPanel", {contentIsOpen: false});
    
if (qsParm['TechnicalDetailsPanel']=='open')
 	TechnicalDetailsPanel = new Spry.Widget.CollapsiblePanel("TechnicalDetailsPanel", {contentIsOpen: true});
else
 	TechnicalDetailsPanel = new Spry.Widget.CollapsiblePanel("TechnicalDetailsPanel", {contentIsOpen: false});

if (qsParm['HistoryPanel']=='open')
 	HistoryPanel = new Spry.Widget.CollapsiblePanel("HistoryPanel", {contentIsOpen: true});
else
 	HistoryPanel = new Spry.Widget.CollapsiblePanel("HistoryPanel", {contentIsOpen: false});
if (qsParm['PublishingResultsPanel']=='open')
 	PublishingResultsPanel = new Spry.Widget.CollapsiblePanel("PublishingResultsPanel", {contentIsOpen: true});
else
 	PublishingResultsPanel = new Spry.Widget.CollapsiblePanel("PublishingResultsPanel", {contentIsOpen: false});


//-->
</script>
</body>
<!-- InstanceEnd --></html>
